package com.auth.config.service;

import com.auth.config.domain.UserDetailsImpl;
import com.ebei.common.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * todo 用户服务实现类 实现security的UserDetailsService
 *
 *
 * @author crazypenguin
 * @version 1.0
 * @created 2018/4/17
 */
@Service("userDetailService")
public class UserDetailServiceImpl implements UserDetailsService {
    @Autowired
    private UserService userService;

    @Override
    public UserDetailsImpl loadUserByUsername(String userAccount) throws UsernameNotFoundException {

        UserVO userVo = userService.findUserByUserAccount(userAccount);
        return new UserDetailsImpl(userVo);
    }
}
